﻿/*
/*NHibernate映射代码模板
/*吕震修改使用升级版My Generation映射 Oracle
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using Model.Common;


namespace Model
{
	/// <summary>
	///	Posts:论坛帖子
	/// </summary>
	[Serializable]
	public partial class Posts : IDataEntity 
	{
		#region 私有成员
			
		private bool keyIsChanged;
		private bool keyIsDeleted;
		private int keyPostId; 
		private int keyModuleId; 
		private int keyBBSUserID; 
		private string keyPostTitle; 
		private string keyPostContent; 
		private int keyVersion;
        private DateTime keyPostCreateTime; 
		private bool keyIsEssence; 
		private bool keyIsAvable; 
		private bool keyIsReplayVisable; 
		private bool keyIsVisable; 
		private DateTime keyEssenceSetTime; 		
		
		#endregion
		
		#region 默认( 空 ) 构造函数
		/// <summary>
		/// 默认构造函数
		/// </summary>
		public Posts()
		{
            keyPostId = 0; 
			keyModuleId = 0; 
			keyBBSUserID = 0; 
			keyPostTitle = null; 
			keyPostContent = null; 
			keyVersion = 0;
            keyPostCreateTime = DateTime.MinValue; 
			keyIsEssence = false; 
			keyIsAvable = false; 
			keyIsReplayVisable = false; 
			keyIsVisable = false; 
			keyEssenceSetTime = DateTime.MinValue; 
		}
		#endregion
		
		#region  公有属性
			
		
		/// <summary>
		/// PostId:帖子Id
		/// </summary>		
		public virtual int PostId
		{
			get { return keyPostId; }
			set { IsChanged |= (keyPostId != value); keyPostId = value; }
		}
			
		
		/// <summary>
		/// ModuleId:模块Id
		/// </summary>		
		public virtual int ModuleId
		{
			get { return keyModuleId; }
			set { IsChanged |= (keyModuleId != value); keyModuleId = value; }
		}
			
		
		/// <summary>
		/// BBSUserID:用户id
		/// </summary>		
		public virtual int BBSUserID
		{
			get { return keyBBSUserID; }
			set { IsChanged |= (keyBBSUserID != value); keyBBSUserID = value; }
		}
			
		
		/// <summary>
		/// PostTitle:帖子标题
		/// </summary>		
		public virtual string PostTitle
		{
			get { return keyPostTitle; }
			set	
			{
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("PostTitle:帖子标题无效!", value, value.ToString());
				
				IsChanged |= (keyPostTitle != value); keyPostTitle = value;
			}
		}
			
		
		/// <summary>
		/// PostContent:帖子内容
		/// </summary>		
		public virtual string PostContent
		{
			get { return keyPostContent; }
			set	
			{
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("PostContent:帖子内容无效!", value, value.ToString());
				
				IsChanged |= (keyPostContent != value); keyPostContent = value;
			}
		}
			
		
		/// <summary>
		/// Version:版本号
		/// </summary>		
		public virtual int Version
		{
			get { return keyVersion; }
			set { IsChanged |= (keyVersion != value); keyVersion = value; }
		}
			
		
		/// <summary>
		///  PostCreateTime:帖子创建时间
		/// </summary>		
		public virtual DateTime PostCreateTime
		{
            get { return keyPostCreateTime; }
            set { IsChanged |= (keyPostCreateTime != value); keyPostCreateTime = value; }
		}
			
		
		/// <summary>
		/// IsEssence:是否精华贴
		/// </summary>		
		public virtual bool IsEssence
		{
			get { return keyIsEssence; }
			set { IsChanged |= (keyIsEssence != value); keyIsEssence = value; }
		}
			
		
		/// <summary>
		/// IsAvable:帖子内容是否有效
		/// </summary>		
		public virtual bool IsAvable
		{
			get { return keyIsAvable; }
			set { IsChanged |= (keyIsAvable != value); keyIsAvable = value; }
		}
			
		
		/// <summary>
		/// IsReplayVisable:是否回复可见
		/// </summary>		
		public virtual bool IsReplayVisable
		{
			get { return keyIsReplayVisable; }
			set { IsChanged |= (keyIsReplayVisable != value); keyIsReplayVisable = value; }
		}
			
		
		/// <summary>
		/// IsVisable:帖子内容是否有效
		/// </summary>		
		public virtual bool IsVisable
		{
			get { return keyIsVisable; }
			set { IsChanged |= (keyIsVisable != value); keyIsVisable = value; }
		}
			
		
		/// <summary>
		/// EssenceSetTime:精华帖设置时间
		/// </summary>		
		public virtual DateTime EssenceSetTime
		{
			get { return keyEssenceSetTime; }
			set { IsChanged |= (keyEssenceSetTime != value); keyEssenceSetTime = value; }
		}
			
			
		/// <summary>
		/// 对象是否为新增
		/// </summary>
		public virtual bool IsAdded
		{
            get { return keyPostId == 0 ? true : false; }
		}
			
		/// <summary>
		/// 对象的值是否被改变
		/// </summary>
		public virtual bool IsChanged
		{
	 		get { return keyIsChanged; }
            set { keyIsChanged = value; }
		}
		
		/// <summary>
		/// 对象是否已经被删除
		/// </summary>
		public virtual bool IsDeleted
		{
			get { return keyIsDeleted; }
		}
		
		#endregion 
		
		#region 公有函数
		
		/// <summary>
		/// 标记对象已删除
		/// </summary>
		public virtual void MarkAsDeleted()
		{
			keyIsDeleted = true;
			keyIsChanged = true;
		}
		
		/// <summary>
		/// 初始化对象标记
		/// </summary>
		public virtual void ResetMark()
		{
			keyIsDeleted = false;
			keyIsChanged = false;
		}
		
		#endregion
		
		#region 重写Equals和HashCode
		/// <summary>
		/// 用唯一值实现Equals
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != GetType() ) ) return false;
			Posts castObj = (Posts)obj; 
			return ( castObj != null ) &&
                (keyPostId == castObj.PostId);
		}
		
		/// <summary>
		/// 用唯一值实现GetHashCode
		/// </summary>
		public override int GetHashCode()
		{
			int hash = 57;
            hash = 27 * hash * keyPostId.GetHashCode();
			return hash; 
		}
		#endregion
		
		
	}
}
